<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title></title>
    <script src="../js/mui.min.js"></script>
    <link href="../css/mui.min.css" rel="stylesheet"/>
    <script src="../js/public.js"></script>
    <script src="../js/jquery.js"></script>
    <style>
    	html,body{height: 80%;}
    	.mission{width: 98%; margin:2rem 1%; height:20px;}
    	.mui-table-view{background: transparent;}
    	.mui-table-view .mui-table-view-cell{background-color: #FFF; padding:1rem; border:0; width: 100%; height: 9rem; margin-bottom: 1rem;}
    	.mui-table-view .mui-table-view-cell a{padding: 0;}
    	.mui-table-view .mui-table-view-cell a div{height: 8rem;}
    	.mui-table-view .mui-table-view-cell a div p{height: 2rem; line-height: 2rem; font-size: 1rem;}
    	.mui-table-view .mui-pull-left{width: 11%; height: 5rem; margin: 0.5rem 1%;}
    	.mui-table-view .mui-pull-right{float: right; width:25%; text-align: center;}
    	.mui-table-view .mui-pull-right span{position: absolute; bottom: 0.2rem; right: 0.5rem; font-size: 0.8rem; color:#929292;}
    	.mui-table-view .mui-media-body{width: 62%; float: left;}
    	.mui-media-body>p>i{font-style: normal;}
    	
    	.mui-pull-right .img{width: 25%;float: right; margin-top: 0.2rem;}
    	.mui-clearfix{float: left; width: 70%;} 
    	.mui-clearfix button{display: block; width: 70%; margin-left: 15%; height: 1.5rem;margin-bottom: 0.5rem; background-color: #169BD5; color:#FFF; border:0; font-size: 0.8rem;;}
    	
    </style>
</head>
<body>
	<div id="pullrefresh" class="mui-content">
	    <div class="mui-content-padded mission">
			<ul class="mui-table-view dai">
			   
			</ul>
	    </div>
	</div>
    
</body>
<script type="text/javascript" charset="utf-8">
var user = JSON.parse(localStorage.getItem('$users')).account;
      	mui.init({
      		swipeBack: false,
			pullRefresh: {
				container: '#pullrefresh',
				down: {
					callback: pulldownRefresh
				},
				up: {
					contentrefresh: '正在加载...',
					callback: pullupRefresh
				}
			},
		  	tap: true, //默认为true
		   	doubletap: true, //默认为false
		   	longtap: true, //默认为false
		   	swipe: true, //默认为true
		  	drag: true, //默认为true
		  	hold:false,//默认为false，不监听
		  	release:false//默认为false，不监听
      	});
      	/*
			   * 下拉刷新具体业务实现
			   */
			  function pulldownRefresh() 
			  {
			    setTimeout(function() 
			    { 
			      	mui.ajax({
			            type: "get",
					    url: "../audit.json",
					    async: true,
					    dataType: "json",
					    json: "jsoncallback",
					    timeout: 1000,
					    success: function(data) {
					    	for(var i=$('.dai li').length,len=i+1;i<len;i++){
					    		var s='<li class="mui-table-view-cell"><a href="javascript:void(0);"><img class="mui-pull-left" src="'+ data[i].img +'"><div class="mui-media-body"><p><span>'+ data[i].cont_b.number +'</span><i class="cz">'+ data[i].cont_b.cont +'</i></p><p><span>'+ data[i].cont_m.number +'</span><i>'+ data[i].cont_m.cont +'</i></p><p><span>'+ data[i].cont_d.number +'</span><i>'+ data[i].cont_d.cont +'</i></p><p><span>'+ data[i].cont_y.number +'</span><i>'+ data[i].cont_y.cont +'</i></p></div><div class="mui-pull-right"><span>'+ data[i].time +'</span></div></a></li>'	
								    $(".dai").append(s);
					    	}
					    },
					    error: function(xhr, type, errorThrown) {
					        plus.nativeUI.toast(errorThrown);
					    }
					});    
			      mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
			    }, 1000);
			  }
			      
			  var count = 0;
			  /*
			   * 上拉加载具体业务实现
			   */
			  function pullupRefresh() 
			  {
			    setTimeout(function() {
			      mui('#pullrefresh').pullRefresh().endPullupToRefresh((++count > 2)); //参数为true代表没有更多数据了。
				  mui.ajax({
			            type: "get",
					    url: "../audit.json",
					    async: true,
					    dataType: "json",
					    json: "jsoncallback",
					    timeout: 1000,
					    success: function(data) {
					    	for(var i=$('.dai li').length,len=i+3;i<len;i++){
					    		var s='<li class="mui-table-view-cell"><a href="javascript:void(0);"><img class="mui-pull-left" src="'+ data[i].img +'"><div class="mui-media-body"><p><span>'+ data[i].cont_b.number +'</span><i class="cz">'+ data[i].cont_b.cont +'</i></p><p><span>'+ data[i].cont_m.number +'</span><i>'+ data[i].cont_m.cont +'</i></p><p><span>'+ data[i].cont_d.number +'</span><i>'+ data[i].cont_d.cont +'</i></p><p><span>'+ data[i].cont_y.number +'</span><i>'+ data[i].cont_y.cont +'</i></p></div><div class="mui-pull-right"><span>'+ data[i].time +'</span></div></a></li>'	
								    $(".dai").append(s);
					    	}
					    },
					    error: function(xhr, type, errorThrown) {
					        plus.nativeUI.toast(errorThrown);
					    }
					});
			    }, 1000);
			  }
			      
			      
			      
			  if (mui.os.plus) {
			    mui.plusReady(function() {
			      setTimeout(function() {
			        mui('#pullrefresh').pullRefresh().pullupLoading();
			      }, 1000);
			
			    });
			  }else 
			  { 
			    mui.ready(function() {
			      mui('#pullrefresh').pullRefresh().pullupLoading();
			    });
			  }
			mui.ajax({
			    type: "get",
			    url: "../audit.json",
			    async: true,
			    dataType: "json",
			    json: "jsoncallback",
			    timeout: 1000,
			    success: function(data) { 	
					$.each(data,function(i,item){
						if(i<5){
							var s='<li class="mui-table-view-cell"><a href="javascript:void(0);"><img class="mui-pull-left" src="'+ item.img +'"><div class="mui-media-body"><p><span>'+ item.cont_b.number +'</span><i class="cz">'+ item.cont_b.cont +'</i></p><p><span>'+ item.cont_m.number +'</span><i>'+ item.cont_m.cont +'</i></p><p><span>'+ item.cont_d.number +'</span><i>'+ item.cont_d.cont +'</i></p><p><span>'+ item.cont_y.number +'</span><i>'+ item.cont_y.cont +'</i></p></div><div class="mui-pull-right"><span>'+ item.time +'</span></div></a></li>'	
						    $(".dai").append(s); 
						}
						                    
					});
			    },
			    error: function(xhr, type, errorThrown) {
			        plus.nativeUI.toast(errorThrown);
			    }
			});
			function receve(){
				mui.ajax({
				    type: "post",
				    url: __PATH__+"index/audit",
				    async: true,
				    data:{
				    	user:user
				    },
				    dataType: "json",
				    json: "jsoncallback",
				    timeout: 1000,
				    success: function(data) { 	
				    	console.log(data);
//						$.each(data,function(i,item){
//							if(i<5){
//								var s='<li class="mui-table-view-cell"><a href="javascript:void(0);"><img class="mui-pull-left" src="'+ item.img +'"><div class="mui-media-body"><p><span>'+ item.cont_b.number +'</span><i class="cz">'+ item.cont_b.cont +'</i></p><p><span>'+ item.cont_m.number +'</span><i>'+ item.cont_m.cont +'</i></p><p><span>'+ item.cont_d.number +'</span><i>'+ item.cont_d.cont +'</i></p><p><span>'+ item.cont_y.number +'</span><i>'+ item.cont_y.cont +'</i></p></div><div class="mui-pull-right"><span>'+ item.time +'</span></div></a></li>'	
//							    $(".dai").append(s); 
//							}
//							                    
//						});
				    },
				    error: function(xhr, type, errorThrown) {
				        plus.nativeUI.toast(errorThrown);
				    }
				});
			}
			setTimeout("receve()",1000);
      	
      	mui('.dai').on('tap',".mui-table-view-cell",function(){
			var parameter = $(this).find(".mui-media-body").find("p").find(".cz").text();
			alert(parameter);
      		mui.openWindow({
			    id:'child_page',
			    url:'child_page.html',
			    extras:{
			        name:parameter
			    }
			});
		});
    </script>
</html>